package ec_si_template;

import java.util.Comparator;

/**
 * Compare and sort an array of individuals wrt index 
 * @author Andreas Janecek 
 *
 */
public class ComparatorByIndex implements Comparator<Individual>{

	@Override
	/**
	 * Compare and sort an array of individuals wrt index 
	 */
	public int compare(Individual o1, Individual o2) {
		if (o1.getindex()<o2.getindex()) return -1;
		if (o1.getindex()>o2.getindex()) return 1;
		return 0;
	}

}
